package effect;

import effect.Effect.EffectType;



public class PowerSurge extends Effect {
	
	int turnsLeft = 0;
	
	public PowerSurge(){
		name="Power Surge";
		description="Increase the creatures damage by 2 for 2 turns";
		imageName="tile_blue.png";
		effectTypes.add(EffectType.activatable);
		effectTypes.add(EffectType.damageModifier);
		effectTypes.add(EffectType.triggerOnTurnEnd);
		targetType = TargetType.none;
		manaCost=4;
	}
	
	@Override
	public void triggerOnTurnEnd(){
		if(turnsLeft > 0)
			turnsLeft--;
	}
	
	@Override
	public int getAddedMinimumDamage(int d){
		if(turnsLeft > 0)
			return 2;
		else
			return 0;
	}
	
	@Override
	public int getAddedMaximumDamage(int d){
		if(turnsLeft > 0)
			return 2;
		else
			return 0;
	}
	
	@Override
	public void activate(){
		EffectUtil.getCard(this).getOwner().addMana(-4);
		
		turnsLeft = turnsLeft + 2;
	}
	@Override
	public boolean canActivate(){
		if(EffectUtil.getCard(this).getOwner().getMana()>=4)
			return true;
		else
			return false;
	}
	
	@Override
	public String getDescription(){
		if(turnsLeft > 0)
			return "The unit is radiating with energy, increasing it's attack by 2 for another "+turnsLeft+" turns.";
		else
			return "Increase the creatures damage by 2 for 2 turns";
	}
	@Override
	public String getImageName(){
		if(turnsLeft > 0)
			return "tile_blue.png";
		else if(!canActivate())
			return "tile_grey.png";
		else
			return "tile_red.png";
	}
}
	

